home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 5.1 KB | 161 lines | [TEXT/MPS ] |
- ;
- ; File: TranslationExtensions.a
- ;
- ; Contains: Macintosh Easy Open Translation Extension Interfaces.
- ;
- ; Version: Technology: Macintosh Easy Open 1.1
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
- __TRANSLATIONEXTENSIONS__ SET 1
-
- IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
- include 'Memory.a'
- ENDIF
- IF &TYPE('__FILES__') = 'UNDEFINED' THEN
- include 'Files.a'
- ENDIF
- IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
- include 'Quickdraw.a'
- ENDIF
- IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
- include 'Components.a'
- ENDIF
-
- kSupportsFileTranslation EQU 1
- kSupportsScrapTranslation EQU 2
- kTranslatorCanGenerateFilename EQU 4
- ; better names for 4-char codes
- ; typedef OSType FileType
-
- ; typedef ResType ScrapType
-
- ; typedef unsigned long TranslationAttributes
-
-
- taDstDocNeedsResourceFork EQU 1
- taDstIsAppTranslation EQU 2
- FileTypeSpec RECORD 0
- format ds.l 1 ; offset: $0 (0)
- hint ds.l 1 ; offset: $4 (4)
- flags ds.l 1 ; offset: $8 (8) ; taDstDocNeedsResourceFork, taDstIsAppTranslation
- catInfoType ds.l 1 ; offset: $C (12)
- catInfoCreator ds.l 1 ; offset: $10 (16)
- sizeof EQU * ; size: $14 (20)
- ENDR
- FileTranslationList RECORD 0
- modDate ds.l 1 ; offset: $0 (0)
- groupCount ds.l 1 ; offset: $4 (4)
- ; unsigned long group1SrcCount;
- ; unsigned long group1SrcEntrySize = sizeof(FileTypeSpec);
- ; FileTypeSpec group1SrcTypes[group1SrcCount]
- ; unsigned long group1DstCount;
- ; unsigned long group1DstEntrySize = sizeof(FileTypeSpec);
- ; FileTypeSpec group1DstTypes[group1DstCount]
- sizeof EQU * ; size: $8 (8)
- ENDR
- ; typedef struct FileTranslationList * FileTranslationListPtr
-
- ; typedef FileTranslationListPtr * FileTranslationListHandle
-
- ScrapTypeSpec RECORD 0
- format ds.l 1 ; offset: $0 (0)
- hint ds.l 1 ; offset: $4 (4)
- sizeof EQU * ; size: $8 (8)
- ENDR
- ScrapTranslationList RECORD 0
- modDate ds.l 1 ; offset: $0 (0)
- groupCount ds.l 1 ; offset: $4 (4)
- ; unsigned long group1SrcCount;
- ; unsigned long group1SrcEntrySize = sizeof(ScrapTypeSpec);
- ; ScrapTypeSpec group1SrcTypes[group1SrcCount]
- ; unsigned long group1DstCount;
- ; unsigned long group1DstEntrySize = sizeof(ScrapTypeSpec);
- ; ScrapTypeSpec group1DstTypes[group1DstCount]
- sizeof EQU * ; size: $8 (8)
- ENDR
- ; typedef struct ScrapTranslationList * ScrapTranslationListPtr
-
- ; typedef ScrapTranslationListPtr * ScrapTranslationListHandle
-
- ; definition of callbacks to update progress dialog
- ; typedef long TranslationRefNum
-
- IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
- ;
- ;****************************************************************************************
- ;*
- ;* This routine sets the advertisement in the top half of the progress dialog.
- ;* It is called once at the beginning of your DoTranslateFile routine.
- ;*
- ;* Enter: refNum Translation reference supplied to DoTranslateFile.
- ;* advertisement A handle to the picture to display. This must be non-purgable.
- ;* Before returning from DoTranslateFile, you should dispose
- ;* of the memory. (Normally, it is in the temp translation heap
- ;* so it is cleaned up for you.)
- ;*
- ;* Exit: returns noErr, paramErr, or memFullErr
- ;
- ;
- ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _SetTranslationAdvertisement
- moveq #2,D0
- dc.w $ABFC
- EndM
- ELSE
- IMPORT_CFM_FUNCTION SetTranslationAdvertisement
- ENDIF
-
- ;
- ;****************************************************************************************
- ;*
- ;* This routine updates the progress bar in the progress dialog.
- ;* It is called repeatedly from within your DoTranslateFile routine.
- ;* It should be called often, so that the user will get feedback if he tries to cancel.
- ;*
- ;* Enter: refNum translation reference supplied to DoTranslateFile.
- ;* progress percent complete (0-100)
- ;*
- ;* Exit: canceled TRUE if the user clicked the Cancel button, FALSE otherwise
- ;* returns noErr, paramErr, or memFullErr
- ;
- ;
- ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _UpdateTranslationProgress
- moveq #1,D0
- dc.w $ABFC
- EndM
- ELSE
- IMPORT_CFM_FUNCTION UpdateTranslationProgress
- ENDIF
-
- ; ComponentMgr selectors for routines
-
- kTranslateGetFileTranslationList EQU 0 ; component selectors
- kTranslateIdentifyFile EQU 1
- kTranslateTranslateFile EQU 2
- kTranslateGetTranslatedFilename EQU 3
- kTranslateGetScrapTranslationList EQU 10 ; skip to scrap routines
- kTranslateIdentifyScrap EQU 11
- kTranslateTranslateScrap EQU 12
- ; Routines to implment in a file translation extension
- ; Routine to implement in a scrap translation extension
- ENDIF
- ENDIF ; __TRANSLATIONEXTENSIONS__
-
-